﻿using BlueDot.Mobile.Core;
using System.Drawing;
using System;
using System.Windows.Forms;

namespace NotifyIcon
{
    public class MainApplication : MobileApplication<MainShell>
    {
        #region Fields

        private string applicationName = "Main Application";

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the ScalperInternationalApplication class.
        /// </summary>
        public MainApplication()
        {
            Configuration = new NotifyIconConfiguration(new Icon("mfly.ico"), true);
        }

        #endregion

        #region Properties

        public override string Name
        {
            get { return applicationName; }
            set { applicationName = value; }
        }

        #endregion

        #region public

        public override void AddWorkflowDirector()
        {
            AddNew<MainWorkflowDirector, IWorkflowDirector>();
        }

        [Receiver(WellKnownActions.ShellShown)]
        public void OnShellShown(object sender, EventArgs args)
        {
            var item = new MenuItem("Exit", delegate { ExitRuntime(); });
            var contextMenu = new ContextMenu(new[] { item });

            ((NotifyIconConfiguration)Configuration).NotifyIcon.ContextMenu = contextMenu;
        }

        #endregion
    }
}